<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Processors | ElasticSearch 7.7 权威指南中文版</title>
	<meta name="keywords" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <meta name="description" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <!-- Give IE8 a fighting chance -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
	<link rel="stylesheet" type="text/css" href="../static/styles.css" />
	<script>
	var _link = 'ingest-processors.html';
    </script>
</head>
<body>
<div class="main-container">
    <section id="content">
        <div class="content-wrapper">
            <section id="guide" lang="zh_cn">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12 col-sm-8 col-md-8 guide-section">
                            <div style="color:gray; word-break: break-all; font-size:12px;">原英文版地址: <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.7/ingest-processors.html" rel="nofollow" target="_blank">https://www.elastic.co/guide/en/elasticsearch/reference/7.7/ingest-processors.html</a>, 原文档版权归 www.elastic.co 所有<br/>本地英文版地址: <a href="../en/ingest-processors.html" rel="nofollow" target="_blank">../en/ingest-processors.html</a></div>
                        <!-- start body -->
                  <div class="page_header">
<strong>重要</strong>: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html" rel="nofollow">当前版本文档</a>。
</div>
<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="index.html">Elasticsearch Guide [7.7]</a></span>
»
<span class="breadcrumb-link"><a href="ingest.html">Ingest node</a></span>
»
<span class="breadcrumb-node">Processors</span>
</div>
<div class="navheader">
<span class="prev">
<a href="match-enrich-policy-type.html">« Example: Enrich your data based on exact values</a>
</span>
<span class="next">
<a href="append-processor.html">Append Processor »</a>
</span>
</div>
<div class="chapter">
<div class="titlepage"><div><div>
<h2 class="title">
<a id="ingest-processors"></a>Processors<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ingest/ingest-node.asciidoc">edit</a>
</h2>
</div></div></div>
<p>All processors are defined in the following way within a pipeline definition:</p>
<div class="pre_wrapper lang-js">
<pre class="programlisting prettyprint lang-js">{
  "PROCESSOR_NAME" : {
    ... processor configuration options ...
  }
}</pre>
</div>
<p>Each processor defines its own configuration parameters, but all processors have
the ability to declare <code class="literal">tag</code>, <code class="literal">on_failure</code> and <code class="literal">if</code> fields. These fields are optional.</p>
<p>A <code class="literal">tag</code> is simply a string identifier of the specific instantiation of a certain
processor in a pipeline. The <code class="literal">tag</code> field does not affect the processor’s behavior,
but is very useful for bookkeeping and tracing errors to specific processors.</p>
<p>The <code class="literal">if</code> field must contain a script that returns a boolean value. If the script evaluates to <code class="literal">true</code>
then the processor will be executed for the given document otherwise it will be skipped.
The <code class="literal">if</code> field takes an object with the script fields defined in <a class="xref" href="script-processor.html" title="Script Processor">script-options</a>
and accesses a read only version of the document via the same <code class="literal">ctx</code> variable used by scripts in the
<a class="xref" href="script-processor.html" title="Script Processor">Script Processor</a>.</p>
<div class="pre_wrapper lang-js">
<pre class="programlisting prettyprint lang-js">{
  "set": {
    "if": "ctx.foo == 'someValue'",
    "field": "found",
    "value": true
  }
}</pre>
</div>
<p>See <a class="xref" href="ingest-conditionals.html" title="Conditional Execution in Pipelines"><em>Conditional Execution in Pipelines</em></a> to learn more about the <code class="literal">if</code> field and conditional execution.</p>
<p>See <a class="xref" href="handling-failure-in-pipelines.html" title="Handling Failures in Pipelines"><em>Handling Failures in Pipelines</em></a> to learn more about the <code class="literal">on_failure</code> field and error handling in pipelines.</p>
<p>The <a class="xref" href="cluster-nodes-info.html" title="Nodes info API">node info API</a> will provide a per node list of what processors are available.</p>
<p>Custom processors must be installed on all nodes. The put pipeline API will fail if a processor specified in a pipeline
doesn’t exist on all nodes. If you rely on custom processor plugins make sure to mark these plugins as mandatory by adding
<code class="literal">plugin.mandatory</code> setting to the <code class="literal">config/elasticsearch.yml</code> file, for example:</p>
<div class="pre_wrapper lang-yaml">
<pre class="programlisting prettyprint lang-yaml">plugin.mandatory: ingest-attachment</pre>
</div>
<p>A node will not start if this plugin is not available.</p>
<p>The <a class="xref" href="cluster-nodes-stats.html" title="Nodes stats API">node stats API</a> can be used to fetch ingest usage statistics, globally and on a per
pipeline basis. Useful to find out which pipelines are used the most or spent the most time on preprocessing.</p>
<h3>
<a id="_ingest_processor_plugins"></a>Ingest Processor Plugins<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ingest/ingest-node.asciidoc">edit</a>
</h3>
<p>Additional ingest processors can be implemented and installed as Elasticsearch <a href="https://www.elastic.co/guide/en/elasticsearch/plugins/7.7/intro.html" class="ulink" target="_top">plugins</a>.
See <a href="https://www.elastic.co/guide/en/elasticsearch/plugins/7.7/ingest.html" class="ulink" target="_top">Ingest plugins</a> for information about the available ingest plugins.</p>


































</div>
<div class="navfooter">
<span class="prev">
<a href="match-enrich-policy-type.html">« Example: Enrich your data based on exact values</a>
</span>
<span class="next">
<a href="append-processor.html">Append Processor »</a>
</span>
</div>
</div>

                  <!-- end body -->
                        </div>
                        <div class="col-xs-12 col-sm-4 col-md-4" id="right_col">
                        
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </section>
</div>
<script src="../static/cn.js"></script>
</body>
</html>